/*
 * Copyright 2010 Alessandro Bellucci
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.soupframework.gwt.designerpanel.client.designer;

import com.google.gwt.event.shared.HasHandlers;
import com.google.gwt.user.client.ui.Widget;

/**
 * Base interface for all designers
 *
 * @param <T> the type of the objects being designed
 */
public interface Designer<T> extends HasHandlers {

	public interface Operations<T> {
		
	}

	/**
	 * Gets a reference to the Operations that can be performed on this {@link Designer}
	 *
	 * @return the reference to the {@link Operations} object
	 */
	public Operations<T> getOperations();

	/**
	 * Gets the manager that manages this designer
	 *
	 * @return the manager
	 */
	public DesignerManager<T> getManager();

	/**
	 * Gets the object being designed by this designer
	 *
	 * @return The object being designed by this designer
	 */
	public T getObject();

	/**
	 * Gets a textual description for the given object
	 */
	public String getObjectDescrition(T object);

	/**
	 * Gets the parent designer for this designer
	 *
	 * @return the parent designer or null if this is the root designer
	 */
	public ContainerDesigner<T> getParent();

	/**
	 * Gets the {@link Widget} that graphically represents the object (the view)
	 *
	 * @return the {@link Widget} representing the object
	 */
	public Widget getObjectView();

	/**
	 * Open context menu for the target object of this {@link Designer}
	 *
	 * @param preferredLeft the preferred left coordinate for the context menu
	 * @param preferredTop the preferred top coordinate for the context menu
	 */
	public void openContextMenu(int preferredLeft, int preferredTop);

	/**
	 * Refreshes the {@link Designer} view.
	 */
	public void refresh();
}
